import request from '@/utils/request'
import { baseResponse } from '@/types/public'
import { Course, CourseAttendanceRecord } from '@/types/student'

export const getStudentCourseList = async () => {
  return (await request.get<baseResponse<Array<Course>>>('Student/GetCourses')).data
}

export const AttendanceCourse = async (attendeeId: number) => {
  return (await request.get<baseResponse<boolean>>(`Student/SignIn?attendeeId=${attendeeId}`)).data
}

export const GetStudentAttendanceList = async (courseName: string) => {
  return (
    await request.get<baseResponse<Array<CourseAttendanceRecord>>>(
      `Student/GetStudentAttendances?courseName=${courseName}`,
    )
  ).data
}
